package com.zy.ivideo.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

@Entity
@EntityListeners(AuditingEntityListener.class)
@Data
@ApiModel(value = "账户实体类",description = "账户实体类")
@Table(name = "s_account")
public class AccountEntity {
    /**
     * 主键
     */
    @ApiModelProperty(value = "主键id",position = 16,example = "0")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 数据类型 0-simplevideo 1-multitypevideo
     */
    @ApiModelProperty(value = "数据类型 0-simplevideo 1-multitypevideo",position = 16,example = "0")
    @Column(name = "userid",nullable = false,length = 11,columnDefinition = "COMMENT '用户id'")
    private Long userid;

    @ApiModelProperty(value = "金币余额",position = 16,example = "100")
    @Column(name = "coinamount",nullable = false,length = 10,columnDefinition = "COMMENT '金币余额'")
    private double coinamount;

    @ApiModelProperty(value = "账号余额",position = 16,example = "1000")
    @Column(name = "accountamount",nullable = false,length = 10,columnDefinition = "COMMENT '账号余额'")
    private double accountamount;

    @ApiModelProperty(value = "支付宝账号",position = 16,example = "xx@zfb.com")
    @Column(name = "zfbaccount",length = 200,columnDefinition = "COMMENT '支付宝账号'")
    private String zfbaccount;

    @ApiModelProperty(value = "微信账号",position = 16,example = "xx@wx.com")
    @Column(name = "wxaccount",length = 200,columnDefinition = "COMMENT '微信账号'")
    private String wxaccount;

    @ApiModelProperty(value = "创建时间",position = 16,example = "2020-01-01 00:00:00")
    @CreatedDate
    @Column(name = "createtime",columnDefinition = "COMMENT '创建时间'")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createtime;

    /**
     * 银行卡号
     */
    @Transient
    private List<BankCardEntity> cards;
}
